package es.sergionadal.mvc.action;

import android.os.Bundle;
import es.sergionadal.mvc.action.exception.ActionException;
import es.sergionadal.mvc.dispatcher.AbstractDispatcher;

public class Action {

	private AbstractDispatcher dispatcher;

	public AbstractDispatcher getDispatcher() {
		return dispatcher;
	}

	public Action(AbstractDispatcher dispatcher) {
		this.dispatcher = dispatcher;
	}

	public void run() throws ActionException {
		Bundle bundle = getBundle();

		if (bundle != null) {
			if (dispatcher.getBundle() == null) {
				dispatcher.setBundle(bundle);
			} else {
				dispatcher.getBundle().putAll(bundle);
			}
		}
	}

	protected Bundle getBundle() throws ActionException {
		return null;
	}
}
